package mincostmaxflow;

import java.util.ArrayList;
import java.util.Vector;

public class Graph<T extends Edge> extends Route<Edge> {

    private ArrayList<Integer> sourceVertices;
    private ArrayList<Integer> drainVertices;

    /**
     * create a new graph with no source or drain vertices based on
     * {@link java.util.Vector Vector} of {@link bellmanfordimplement.Edge Edge} received
     * @param e Vector
     */
    public Graph(Vector<Edge> e){
        super(e);
	this.sourceVertices = new ArrayList<Integer>();
	this.drainVertices = new ArrayList<Integer>();

    }

    /**
     * create a new graph with source vertices and drain vertices based on
     * {@link java.util.Vector Vector} of {@link bellmanfordimplement.Edge Edge} and two
     * {@link java.util.ArrayList ArrayLists} of {@link java.lang.Integer Integer}, where
     * first ArrayList contains numbers of source vertices, and second contains numbers
     * of drain vertices
     * @param e Vector
     * @param src ArrayList
     * @param drn ArrayList
     */
    public Graph(Vector<Edge> e, ArrayList<Integer> src, ArrayList<Integer> drn){
	super(e);
	this.sourceVertices = new ArrayList<Integer>(src);
	this.drainVertices = new ArrayList<Integer>(drn);
    }

    public Graph(){
	super();
	this.sourceVertices = new ArrayList<Integer>();
	this.drainVertices = new ArrayList<Integer>();
    }

    /**
     * adds a vertex to sources
     * @param n
     */
    public void addSourceVertex(int n){
	this.sourceVertices.add(n);
    }

    /**
     * adds a vertex to drains
     * @param n
     */
    public void addDrainVertex(int n){
	this.drainVertices.add(n);
    }

    /**
     * returns the amount of sources of this graph
     * @return
     */
    public int sourcesAmount(){
	return this.sourceVertices.size();
    }

    /**
     * returns the amount of drains of this graph
     * @return
     */
    public int drainsAmount(){
	return this.drainVertices.size();
    }

    public ArrayList<Integer> getSources(){
	return this.sourceVertices;
    }

    public ArrayList<Integer> getDrains(){
	return this.drainVertices;
    }
   
}

